<template>
  <div>
    <ul>
      <li v-for="(item, index) in users" :key="item.id">
        <span>{{ item.name }}</span> --
        <!-- 作用域插槽 -->
        <slot name="edit" :idx="index">
          <span @click="clickFn(index)"> 修改 </span>
        </slot>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: ['users'],
  methods: {
    clickFn(index) {
      console.log(index)
    }
  }
}
</script>

<style lang="scss" scoped></style>
